{template 'common/header'}
<ul class="nav nav-tabs">
	<li {if $op == 'display'}class="active"{/if}><a href="{php echo $this->createWebUrl('distributor', array('op' => 'display'));}">分销商列表</a></li>
</ul>
{if $op == 'display'}
<style>
.table td span{display:inline-block;margin-top:4px;}
.table td input{margin-bottom:0;}
th{
	text-align: center !important;
}
td{
	text-align: center !important;
}
</style>
<div class="main">
	<form action="" method="get" class="form-horizontal" role="form">
		<div class="panel panel-info">
	        <div class="panel-heading">筛选</div>
	        <div class="panel-body">
	                <input type="hidden" name="c" value="site" />
	                <input type="hidden" name="a" value="entry" />
	                <input type="hidden" name="m" value="junsion_wifinav" />
	                <input type="hidden" name="do" value="distributor" />
	                <div class="form-group">
	                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">关键字</label>
	                    <div class="col-sm-3 col-xs-12">
	                        <input class="form-control" name="keyword" id="" type="text" value="{$_GPC['keyword']}" placeholder="请输入昵称、姓名">
	                    </div>
	                    <div class=" col-xs-12 col-sm-6 col-lg-3">
	                        <button class="btn btn-default" ><i class="fa fa-search"></i> 搜索</button>
	                   	</div>
	                </div>
	                
	        </div>
	    </div>
	</form>
	<div style="padding:15px;background: white;">
		<table class="table table-hover">
			<thead class="navbar-inner">
				<tr>
					<th>昵称</th>
					<th>姓名</th>
					<th>电话</th>
					<th>性别</th>
					<th>状态</th>
				</tr>
			</thead>
			<tbody>
				{loop $list $item}
				<tr>
					<td><img width="80" src="{php echo toimage($item['avatar'])}"><br>{$item['nickname']}</td>
					<td>{$item['realname']}</td>
					<td>{$item['mobile']}</td>
					<td>{if $item['gender']==2}<label class="label label-success">女</label>{else}<label class="label label-info">男</label>{/if}</td>
					<td>
						{if $item['distributor']==2}<label class="label label-success" onclick="Audit(this,{$item['id']})">正常</label>{else}<label class="label label-info" onclick="Audit(this,{$item['id']})">申请</label>{/if}
					</td>
				</tr>
				{/loop}
			</tbody>
		</table>
		{$pager}
	</div>
</div>
<script type="text/javascript">
function Audit(obj,id){
	var label = $(obj);
	$.ajax({
		url:'{php echo $this->createWebUrl("distributor",array("op"=>"audit"))}',
		type:'post',
		data:{id:id},
		success:function(status){
			if(status!=1) return false;
			if(label.hasClass('label-info')){
				label.removeClass('label-info').addClass('label-success');
				label.text('正常');
			}else{
				label.removeClass('label-success').addClass('label-info');
				label.text('申请');
			}
		}
	});
}
</script>
{/if}
{template 'common/footer'}